import request from '@/utils/request'

export function getAdvertise(info) {
	return request({
		headers:{
			// "Accept":"application/json, text/plain,charset_utf-8"
		},
		url: `/api/home/advertise/list`,
		method: 'POST',
		params: {
			name: info
		}
	});
};

export function createAdvertise(query) {
	return request({
		url: "/api/home/advertise/create",
		method: "POST",
		data: query
	})
}

export function updateAdvertise(id, query) {
	return request({
		url: `/api/home/advertise/update/${id}`,
		method: "POST",
		data: query
	})
}


export function statusAdvertise(id, status) {
	const query = new FormData();
	query.append("status", status);
	return request({
		headers: {
			"Content-Type": "multipart/form-data"
		},
		url: `/api/home/advertise/update/status/${id}`,
		method: "POST",
		data: query
	})
}

export function detailAdvertise(id) {
	return request({
		url: `/api/home/advertise/${id}`,
		method: "GET"
	})
}

export function deleteAdvertise(id) {
	const query = new FormData();
	let ids = id.toString();
	query.append("ids", ids);
	return request({
		headers: {
			"Content-Type": "application/x-www-form-urlencoded"
		},
		url: `/api/home/advertise/delete`,
		method: "POST",
		data: query
	})
}
